/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 殇
 * Date: 2025-05-30
 * Time: 12:09
 */
public class Student {
    private String name;
    private int age;

    public static String classRoom;

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
    public static void print1(){
        //print2();  报错，非静态依赖于对象，必须先new对象
        //System.out.println("name="+name);  报错，非静态依赖于对象
        System.out.println("静态方法");
    }
    public void print2(){
        print1();
        System.out.println("非静态方法");
    }

    public static void main(String[] args) {
        Student s1=new Student("张三",18);
        //s1.classRoom="c1";
        //s1.print();
        Student s2=new Student("李四",19);
        //s2.classRoom="c2";
        //s2.print();
        Student.print1();
    }
}
